package com.softservecom.training.shop.pojos;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Orders entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Orders", schema = "dbo", catalog = "Java")
public class Orders implements java.io.Serializable {

	// Fields

	private Integer orderId;
	private Users users;
	private Products products;
	private Date date;

	// Constructors

	/** default constructor */
	public Orders() {
	}

	/** full constructor */
	public Orders(Integer orderId, Users users, Products products, Date date) {
		this.orderId = orderId;
		this.users = users;
		this.products = products;
		this.date = date;
	}

	// Property accessors
	@Id
	@Column(name = "OrderID", unique = true, nullable = false)
	public Integer getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UserID", nullable = false)
	public Users getUsers() {
		return this.users;
	}

	public void setUsers(Users users) {
		this.users = users;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ProductID", nullable = false)
	public Products getProducts() {
		return this.products;
	}

	public void setProducts(Products products) {
		this.products = products;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "Date", nullable = false, length = 23)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}